﻿// Original author contact info: Owen Emlen (owene_1998@yahoo.com)
// Note: other individuals may also have contributed to this code
// Project hosted on CodePlex.com as of 1/10/2009 at http://www.codeplex.com/EmlenMud
using System.Runtime.Serialization;
using System;
using System.ComponentModel;

namespace BrainTechLLC
{
    [Serializable]
#if NO_SILVERLIGHT
    [Browsable(true)]
    [TypeConverter(typeof(ExpandableObjectConverter))]
#endif
    [DataContract]
    public class SpeedFloat : Vector4BaseFloat, ISpeedFloat, IQuickCopy, IHasSpeedFloat
    {
        public SpeedFloat() { }
        public SpeedFloat(SpeedFloat speed) : base(speed) { }

        public ISpeedFloat SpeedVector { get { return this; } }
        public bool Moving { get { return (X != 0) || (Y != 0) || (Z != 0); } }

        public float LinearSpeedFloat { get { return Length3D(); } }
        public float SpeedX { get { return X; } set { X = value; } }
        public float SpeedY { get { return Y; } set { Y = value; } }
        public float SpeedZ { get { return Z; } set { Z = value; } }

        public SpeedFloat(float x, float y, float z, float w) : base(x, y, z, w) { }
        public SpeedFloat(float x, float y, float z) : base(x, y, z) { }

        public virtual object Copy() { return new SpeedFloat(X, Y, Z, W); }

        // TODO: this shouldn't modify the passed in SpeedFloat object
        public static SpeedFloat operator /(SpeedFloat speed, float f)
        {
            speed.X /= f;
            speed.Y /= f;
            speed.Z /= f;
            return speed;
        }
    }
}
